package com.hax2max.model;

import java.util.Date;

import com.hax2max.R;
/**
 * Responsible for passing data containing status updates for social media services such as facebook, twitter.
 * 
 * New sources have to be added to this class if the number of external sources is extended.
 *
 * */
public class ExternalData {
	
	public String username; // the owner of the object
	public String login; // login name for the service
	public String userId; // the id for user in the external service (often the same as login)
	public String password; // the password used for logging in to the external service
	public String statusText; // the text (status that user sets)
	public Date latestUpdate; // the time the status was set
	public int application; // which application the data object represents
	public Boolean success; // used for error handling, true if status was succesfully set
	public String errorMsg; // used for passing error messages
	

	
	public static String usernameColumn = "username";
	public static String loginColumn = "login";
	public static String userIdColumn = "userid";
	public static String passwordColumn = "password";
	public static String statusTextColumn = "statustext";
	public static String latestUpdateColumn = "latestupdate";
	public static String applicationColumn = "application";
	public static String successColumn = "success";
	public static String errormsgColumn = "errormsg";
	
	public static final int ApplicationIDFriendStalker = 0;
	public static final int ApplicationIDFacebook = 1;
	public static final int ApplicationIDTwitter = 2;
	
	public static int[] applications = {
		ApplicationIDFriendStalker, 
		ApplicationIDFacebook, 
		ApplicationIDTwitter}; // do not forget to change this when adding application support
	
	public static int[] applicationIcons = { 
		R.drawable.friendstalker,
		R.drawable.facebook, 
		R.drawable.twitter}; // has to go in the same order as the ID's
	
	@Override
    public String toString()
    {             
		return (login==null? "" : login)+";"+(password==null? "" : password) +";"+(statusText==null? "" : statusText) + ";"+ (latestUpdate==null? "" : latestUpdate.getTime()) +";"+(application<0? "0" : application)+";"+(success==null? "false" : "true")+";"+(errorMsg==null? "" : errorMsg);
    }
	
}